<!-- 语言提示 -->
<div id="languagePrompt">请选择语言</div>

<!-- 示例元素 -->
<div tabindex="0" class="selectable">简体中文</div>
<div tabindex="0" class="selectable">繁体中文</div>
<div tabindex="0" class="selectable">English</div>

<script>
document.addEventListener('keydown', function(event) {
  const selectableElements = document.querySelectorAll('.selectable');
  let index = Array.from(selectableElements).findIndex(el => el === document.activeElement);

  switch (event.key) {
    case 'Tab':
      event.preventDefault();
      selectableElements[(index + 1) % selectableElements.length].focus();
      break;
    case 'F4':
      alert('确定选项: ' + document.activeElement.textContent);
      break;
    case 'F6':
      alert('取消操作');
      break;
    case 'ArrowUp':
      if (index > 0) {
        selectableElements[index - 1].focus();
      }
      break;
    case 'ArrowDown':
      if (index < selectableElements.length - 1) {
        selectableElements[index + 1].focus();
      }
      break;
  }
});
</script>
